<?php

echo $this->get_tag('form',array('method'=>'post','class'=>'app_form','action'=>$this->baseurl("/developer/sys-config")));
    echo $this->callElement("default/tools/tool_bar",array("buttons"=>array(array("type"=>"save"),array("type"=>"back")) ,"title" => "System Configuration"));
            
        echo $this->callElement("default/tools/message",array("message" => $message));

        $options = $sysconf->getElementsByTagName('option');
        $form = Array();
        foreach( $options as $option )
        {
            $choice = $option->getElementsByTagName('choice')->item(0)->nodeValue;
            $flag = $option->getElementsByTagName('flag')->item(0)->nodeValue;

            $options = ( $flag == 1 ) ? array('disabled'=>'disabled') : array();
            $options['class'] = 'sys-conf-input';

            if( $choice != "" )
            {
                $choice = explode("|",$choice);
                $choice_arr = array();
                foreach($choice as $val)$choice_arr[$val] = $val;
                $options['style'] = 'width:300px;';

                $input_box = App::load("Helper/Html")->selectTag("data[sconfig][{$option->getAttribute('name')}]",$choice_arr,$option->getElementsByTagName('value')->item(0)->nodeValue,$options);
            }
            else
            {
                $options['style'] = 'width:288px;padding:5px;border:1px solid #CECECE';
                $input_box = App::load("Helper/Html")->inputTag("data[sconfig][{$option->getAttribute('name')}]",$option->getElementsByTagName('value')->item(0)->nodeValue,$options);
            }
            
            if( $flag == 1 ) $input_box .= '<input type="checkbox" class="sys-conf-chk" checked="checked" /> System Defalut value';
            else $input_box .= '<input type="checkbox" class="sys-conf-chk" /> System Defalut value';

            $form[] = array(    "title"=> $option->getElementsByTagName('title')->item(0)->nodeValue,
                                "value" =>  $input_box);


        }
        echo $this->callElement('default/tools/column_listing',	array("listing_data" => $form));
    echo $this->callElement("default/tools/tool_bar",array("buttons"=>array(array("type"=>"save"),array("type"=>"back")) ,"title" => NULL));
echo $this->get_tag('/form');
?>
<script type="text/javascript">
    window.addEvent('domready', function() 
    {
        $$('.sys-conf-chk').addEvent('click', function()
        {
             var __obj = this.getParents('td').getChildren('select[class=sys-conf-input]');
             if( __obj == "" ) __obj = this.getParents('td').getChildren('input[class=sys-conf-input]');

            if( this.get('checked') ) __obj[0].set('disabled',true)
            else __obj[0].set('disabled',false);
        });
    });
</script>